package com.strategy.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;

/**
 * 策略实体类，用于存储策略的基本信息（名称、版本、状态等）
 */
@Schema(description = "策略实体类，存储策略的基本信息（名称、版本、状态等）",name = "策略信息")
@Getter
@Setter
@TableName("t_strategy")
public class StrategyEntity {

    @Schema(description = "策略ID（主键，自动生成）", example = "123456")
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    @Schema(description = "策略标识（唯一标识策略类型，如'calculator'）", example = "calculator")
    private String strategyKey;

    @Schema(description = "策略版本号（如'1.0.0'）", example = "1.0.0")
    private String version;

    @Schema(description = "策略描述信息（说明策略功能）", example = "加法计算策略：将输入值与参数value相加")
    private String description;

    @Schema(description = "策略实现类全路径（如'com.strategy.example.AddStrategy'）", example = "com.strategy.example.AddStrategy")
    private String className;

    @Schema(description = "是否为默认版本（true-是，false-否）", example = "true")
    private Boolean isDefault;

    @Schema(description = "状态（0-禁用，1-启用）", example = "1")
    private Integer status;

    @Schema(description = "创建时间（自动填充）", example = "2024-05-20 10:00:00")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    @Schema(description = "更新时间（自动填充，创建/修改时更新）", example = "2024-05-20 10:30:00")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;

    @Schema(description = "逻辑删除标识（0-未删除，1-已删除）", example = "0")
    @TableLogic
    private Integer deleted;
}